﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TimeCountDown.ascx.cs" Inherits="BestBuy.UserControls.TimeCountDown" %>

<asp:Panel ID="TimeCountDownContainer" runat="server" CssClass="message-panel alert" Visible="false">
    <div id="TimeCountDown"></div>
    <script type="text/javascript">
        var leave =<%=seconds %>;
        if(leave > 0)
        {
            CounterTimer();
            var interv=setInterval(CounterTimer,1000);
        }
        function CounterTimer()
        {
            var day = Math.floor(leave / ( 60 * 60 * 24))
            var hour = Math.floor(leave / 3600) - (day * 24)
            var minute = Math.floor(leave / 60) - (day * 24 *60) - (hour * 60)
            var second = Math.floor(leave) - (day * 24 *60*60) - (hour * 60 * 60) - (minute*60)
            var remain=day + " d " + hour + " h " + minute + " min. " + second + " s";
            leave=leave-1;
            document.getElementById("TimeCountDown").innerHTML=remain;
        }
    </script>
</asp:Panel>